// 路由的配置文件
import { createRouter, createWebHashHistory } from "vue-router" //专门帮我们创建一个路由管理对象

//导入页面
import home from "../views/home.vue"
import login from "../views/login.vue"
import register from "../views/register.vue"

//二级路由页面
import movie from "../views/movie.vue"
import hall from "../views/hall.vue"
import plan from "../views/plan.vue"
import my from "../views/my.vue"
import movieDetail from "../views/movieDetail.vue"
import planInfoList from "../views/planInfoList.vue"
import test from "../views/test.vue"
import chooseSite from "../views/chooseSite.vue"
import willShowMovie from "../views/willShowMovie.vue"
import hotMovie from "../views/hotMovie.vue"
import classicMovie from "../views/classicMovie.vue"
import SearchMovie from "../views/SearchMovie.vue"


const router = createRouter({
    routes: [
        {
            path: '/',
            //路由重定向
            redirect: {
                name: "hotMovie"
            }
        },
        {
            path: "/home",
            component: home,
            name: "home",
            children: [
                {
                    path: "/home/movie",
                    component: movie,
                    name: "movie",
                    children: [
                        {
                            path: "/home/willShowMovie",
                            component: willShowMovie,
                            name: "willShowMovie",
                        },
                        {
                            path: "/home/hotMovie",
                            component: hotMovie,
                            name: "hotMovie",
                        },
                        {
                            path: "/home/classicMovie",
                            component: classicMovie,
                            name: "classicMovie",
                        },
                    ]
                },
                {
                    path: "/home/hall",
                    component: hall,
                    name: "hall"
                },
                {
                    path: "/home/plan",
                    component: plan,
                    name: "plan"
                },
                {
                    path: "/home/my",
                    component: my,
                    name: "my"
                },
            ]
        },
        {
            path: "/login",
            component: login,
            name: "login",
            children: [{
                path: "/test",
                component: test,
                name: "test"
            },]
        },
        {
            path: "/movieDetail",
            component: movieDetail,
            name: "movieDetail"
        },
        {
            path: "/planInfoList",
            component: planInfoList,
            name: "planInfoList"
        },
        {
            path: "/register",
            component: register,
            name: "register"
        },
        {
            path: "/chooseSite",
            component: chooseSite,
            name: "chooseSite"
        },
        {
            path: "/SearchMovie",
            component: SearchMovie,
            name: "SearchMovie"
        },
    ],
    history: createWebHashHistory()
});



export default router;